home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / max201b.zip / MAX_U.H < prev    next >
C/C++ Source or Header  |  1992-02-29  |  13KB  |  241 lines

  1. /*# name=Maximus USER.BBS structure definition
  2. */
  3.  
  4.  
  5. /* NOTE:  This structure is semi-stable.  Although it is still compatible  *
  6.  * with the old Opus 1.03 structure, don't expect it to stay that way      *
  7.  * for long.  In a future version, Maximus will be using a dymaic-sized    *
  8.  * user record, making it possible to make additions without breaking      *
  9.  * preexisting software.  You can start to code for this now in your       *
  10.  * software, as the usr.struct_len variable indicates the length of the    *
  11.  * current user structure, divided by twenty.  This allows us to build up  *
  12.  * a base of utilities, and be able to switch to a new format (while still *
  13.  * not breaking anything) in the future.  Also, if usr.sruct_len==0, then  *
  14.  * you MUST assume that the length of the structure is actually 180 bytes  *
  15.  * long, as Opus (and Maximus v1.00 only) did not use this field.  In      *
  16.  * other words:                                                            *
  17.  *                                                                         *
  18.  * len_of_struct=(usr.struct_len ? (usr.struct_len*20) : 180)              *
  19.  *                                                                         *
  20.  * In addition, you can assume that all user records in the user file are  *
  21.  * the SAME size...  ie. You can just read the first user record out of    *
  22.  * the file, and you are assured that the rest of the records in the file  *
  23.  * area also the same size.                                                *
  24.  *                                                                         *
  25.  *                                                                         *
  26.  * Example for reading in the dynamic-sized user structure:                *
  27.  *                                                                         *
  28.  *    {                                                                    *
  29.  *      struct _usr users[MAX_USERS];                                      *
  30.  *                                                                         *
  31.  *      int x,                                                             *
  32.  *          userfile,                                                      *
  33.  *          s_len;                                                         *
  34.  *                                                                         *
  35.  *      if ((userfile=open(ufile_name,O_RDONLY | O_BINARY))==-1)           *
  36.  *        Error();                                                         *
  37.  *                                                                         *
  38.  *      read(userfile,&users[0],sizeof(struct _usr));                      *
  39.  *                                                                         *
  40.  *      s_len=users[0].struct_len ? users[0].struct_len*20 : 180;          *
  41.  *                                                                         *
  42.  *      for (x=0;x < MAX_USERS;x++)                                        *
  43.  *      {                                                                  *
  44.  *        lseek(userfile,(long)x*(long)s_len,SEEK_SET);                    *
  45.  *        read(userfile,&users[x],sizeof(struct _usr));                    *
  46.  *      }                                                                  *
  47.  *                                                                         *
  48.  *      close(userfile);                                                   *
  49.  *    }                                                                    *
  50.  *                                                                         *
  51.  * If anything is added to the user structure, it will be appended to the  *
  52.  * END of the structure, so you can be assured that the offsets of each    *
  53.  * individual variable will NOT change.                                    *
  54.  *                                                                         *
  55.  * Also, when ADDING or DELETING users, certain special operations have    *
  56.  * to be performed, mainly those related to the lastread pointers.  When   *
  57.  * adding a user, the procedure is fairly simple; just make sure that      *
  58.  * usr.lastread_ptr is a unique number, different from all others in       *
  59.  * USER.BBS.  Although Max uses a somewhat complicated algorithm to        *
  60.  * fill gaps in the user file, most utility programs can just read through *
  61.  * USER.BBS, and keep a running tally of the HIGHEST usr.struct_len        *
  62.  * variable.  Once you have that, increment it by one, and stuff it into   *
  63.  * the usr.struct_len of the user to be added.                             *
  64.  *                                                                         *
  65.  * When DELETING users, you must go through the process of "cleansing"     *
  66.  * the lastread pointers for the user you deleted.  The procedure for this *
  67.  * is simple:  For every area listed in AREAS.CTL, open the LASTREAD.BBS   *
  68.  * file for that area, and seek to the offset...                           *
  69.  *                                                                         *
  70.  *    usr.lastread_ptr*(long)sizeof(int)                                   *
  71.  *                                                                         *
  72.  * ...and write *two* NUL bytes (ASCII 00).                                *
  73.  *                                                                         *
  74.  * Please note that you do NOT need to do anything special to sort the     *
  75.  * user file...  Since the lastread offset is stored in usr.lastread_ptr,  *
  76.  * you can sort the user file with impunity, and even use old Opus 1.03    *
  77.  * sort utilities.                                                         */
  78.  
  79.  
  80.  
  81. #include "typedefs.h"
  82. #include "stamp.h"
  83.  
  84.  
  85. #define MAX_ALEN         10     /* Max length of usr.msg[] and usr.files[]  */
  86.  
  87.  
  88. /* Masks for usr.bits1, below */
  89.  
  90. #define BITS_HOTKEYS     0x0001 /* Hotkeys, independent of HOTFLASH level   */
  91. #define BITS_NOTAVAIL    0x0002 /* If set, user is NOT normally available   *
  92.                                  * for chat.                                */
  93. #define BITS_FSR         0x0004 /* Full-screen reading in msg areas         */
  94. #define BITS_NERD        0x0008 /* Yelling makes no noise on sysop console  */
  95. #define BITS_NOULIST     0x0010 /* Don't display name in userlist           */
  96. #define BITS_TABS        0x0020 /* Reserved                                 */
  97. #define BITS_BIT6        0x0040 /* Reserved                                 */
  98. #define BITS_BIT7        0x0080 /* Reserved                                 */
  99.  
  100.  
  101. /* Masks for usr.bits2, below */
  102.  
  103. #define BITS2_BADLOGON   0x0001 /* MAX: if user's last logon attempt was bad*/
  104. #define BITS2_IBMCHARS   0x0002 /* MAX: if user can receive high-bit chars  */
  105. #define BITS2_RSVD1      0x0004 /* MAX: *obsolete* 1.02 avatar flag         */
  106. #define BITS2_BORED      0x0008 /* Use the line-oriented editor             */
  107. #define BITS2_MORE       0x0010 /* Wants the "MORE?" prompt                 */
  108. #define BITS2_RSVD2      0x0020 /* OPUS: set=wants Ansi                     */
  109. #define BITS2_CONFIGURED 0x0040 /* OPUS: set=used Maximus before            */
  110. #define BITS2_CLS        0x0080 /* OPUS: set=transmit ^L, clear=ignore ^L   */
  111. #define BITS2_BIT8       0x0100 /* used to be 'usr.keys'                    */
  112. #define BITS2_BIT9       0x0200 /* used to be 'usr.keys'                    */
  113. #define BITS2_BITA       0x0400 /* used to be 'usr.keys'                    */
  114. #define BITS2_BITB       0x0800 /* used to be 'usr.keys'                    */
  115. #define BITS2_BITC       0x1000 /* used to be 'usr.keys'                    */
  116. #define BITS2_BITD       0x2000 /* used to be 'usr.keys'                    */
  117. #define BITS2_BITE       0x4000 /* used to be 'usr.keys'                    */
  118. #define BITS2_BITF       0x8000 /* used to be 'usr.keys'                    */
  119.  
  120.  
  121. /* Masks for usr.delflag, below */
  122.  
  123. #define UFLAG_DEL   0x01
  124. #define UFLAG_PERM  0x02
  125.  
  126. /* Masks for usr.xp_flag, below */
  127.  
  128. #define XFLAG_EXPDATE    0x0001 /* Use the xp_date to control access        */
  129. #define XFLAG_E